
function readData(key, str){
    var data = localStorage.getItem("grab_" + key);
    return data || str;
}

function saveData(key, str){
    localStorage.setItem("grab_" + key, str);
}

function makeLinks(str, start, end){
    var urls = [];
    for(var i = start; i <= end; i++){
        var url = "";
        var res = str.match(/@+/)[0];
        var len = res.length;
        if(len == 1){
            url = str.replace(res, i);
        }
        else{
            var t = (new Array(len).fill(0)).join("") + i;
            url = str.replace(res, t.substr(-len));
        }
        urls.push(url);
    }
    return urls;
}

export default {
    makeLinks,
    readData,
    saveData
}